#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int main() {
  int n;
  cin >> n;
  while (n--) {
    int a;
    cin >> a;
    v.clear();
    for (int i = 1; i <= a / i; ++i) {
      if (a % i == 0) {
        v.push_back(i);
        if (i != a / i) v.push_back(a / i);
      }
    }
    sort(v.begin(), v.end());
    for (auto el : v) {
      cout << el << ' ';
    }
    cout << endl;
  }
}
